<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>合作公司列表</title>
<link rel="stylesheet" href="${base}/images/contentImage/main.css" />
<script type="text/javascript" src="${base}/js/jquery-1.8.0.min.js"></script>

<script type="text/javascript" src="${base}/js/My97DatePicker4_8/WdatePicker.js"></script>
<link href="${base}/resources/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/js/list.js"></script>

 <!-- 引入弹出JS begin -->
<script type="text/javascript" src="${base}/js/lhgdialog/lhgdialog.min.js?self=true"></script>

<script>
$(document).ready(function(){
	var $deleteButton = $("#deleteButton")
	$deleteButton.unbind();
	$deleteButton.click( function() {
		var $this = $(this);
		if ($this.hasClass("disabled")) {
			return false;
		}
		var $checkedIds = $("#listForm input[name='ids']:enabled:checked");	
		
		$.dialog.confirm('是否确定删除?',function(){
			$.dialog.tips('合作公司删除中...',999999,'loading.gif');
			$.ajax({
				type: 'POST',
				dataType : "json",
				data:{"companyIdStr":getCheckBox()},
				url:  "${base}/company/admin/deleteCompany.html",
				error: function (e) {//请求失败处理函数
					$.dialog.alert('请求失败！' + e); 				
				},
				success:function(data){ //请求成功后处理函数。 
					$.dialog.alert(data.result,function(){
						refreshIframe();
					});
				}
			});			
		},function(){},this);

	});
});

function updateCompany(id){
	 var url = "${base}/company/admin/editCompany.html?companyId="+id;
     location.href = url
}

function getCheckBox(){	 
    var ids="";
    $("input[name='ids']:checked").each(function(){  
		ids += $(this).val()+",";
	});
    if (ids.length > 0) ids = ids.substring(0, ids.length-1);      
	return ids;
}

function addCompany(){
	var url = "${base}/company/admin/addCompany.html";
	location.href = url;
}
function showCompany(id){
	var url = "${base}/company/admin/showCompany.html?companyId="+id;
	location.href = url;
}

function refreshIframe(){
	$("#listForm").submit();
}
</script>
</head>

<body>
	<div class="path">合作公司管理&raquo; 公司列表</div>

	<form id="listForm" action="${base}/company/admin/list.html" method="post">
		<!-- 隐藏域 begin-->

		<!-- 隐藏域 end-->
		<div class="bar">
			<a href="javascript:addCompany();" class="iconButton"> <span
				class="addIcon">&nbsp;</span>增加
			</a>

			<div class="buttonWrap">
				<a href="javascript:delCompany();" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>删除
				</a>
			</div>
			<div class="menuWrap">
				<div class="search">
					<span id="searchPropertySelect" class="arrow">&nbsp;</span> <input
						type="text" id="searchValue" name="searchValue"
						value="${searchValue!}" maxlength="200" />
					<button type="submit">&nbsp;</button>
				</div>
				<div class="popupMenu">
					<ul id="searchPropertyOption">
						<li><a href="#" <#if searchProperty??&&searchProperty=='companyName'>class="current"</#if> val="companyName">公司名称 </a></li>
					</ul>
				</div>
				<@s.pageBox page/>
			</div>

		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check"><input type="checkbox" id="selectAll" /></th>
				<th><a href="#">公司名称</a></th>
				<th><a href="#">会员专享</a></th>
				<th><a href="#">中文地址</a></th>
				<th><a href="#">电话</a></th>
				<th><a href="#">邮件</a></th>
				<th><a href="#">ICON图标</a></th>
				<!-- <th><a href="#">昵称</a></th>-->
				<th><a href="#">操作</a></th> 

			</tr>

			<#if page.list??>
			<#list page.list as company>
			<tr>
				<td><input type="checkbox" name="ids" value="${company.companyId}"/></td>				
				<td><span> ${company.companyName}</span></td>
				<td>
					<span>
						<#if company.isForMember == true>
						<font color="blue">是</font>
						<#else>
						<font color="red">否</font>
						</#if>
					</span>
				</td>
				<td><span> ${company.linkMan}</span></td>
				<td><span> ${company.telephone}</span></td>
				<td><span> ${company.email}</span></td>
				<td>
					<span>
						<#if company.iconId != null>
							<img src="${base}${company.icon.imgUrl}" alt=""  width="50" height="50" />
						<#else>
							无
						</#if>
					</span>
				</td>

				<!-- <td><span> ${company.registName} </span></td>
				<td><span> ${company.userName} </span></td> -->
				<td>
					<a href="javascript:showCompany(${company.companyId});">查看</a>
					&nbsp;|&nbsp;	
				    <a href="javascript:updateCompany(${company.companyId});">修改</a>
				</td>
			</tr>
			</#list> 
			</#if>
		</table>
		<#include "${rc.getContextPath()}/common/pagination.html"/>
	</form>


</body>
</html>
